<div id="wrap">
    <h1><?php echo $this->title; ?></h1>
    <div class="statisticsNav">
        <div class="subject">
            <h1>科目</h1>
            <ul>
                <li class="on">总分</li>
                <?php if(!empty($exam_subject_array)): ?>
                <?php   foreach($exam_subject_array as $cVal): if(!empty($cVal)): ?>
                <li><?php echo $cVal['subject_name']; ?></li>
                <?php   endif;   endforeach; ?>
                <?php endif; ?>
                <!--<li>全科合格率</li>-->
            </ul>
        </div>
        <p style="clear:both;"></p>
    </div>
    <div class="clearfix">
	    <ul class="statisticsType_nav">
	        <li class="on">平均分</li>
	        <li>优秀率</li>
	        <li>及格率</li>
	        <li>低分率</li>
	    </ul>
	    <div id="statisticsChart"></div>
    </div>
    <div class="clearfix">
    	<input type="submit" value="导出" name="submit" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 cursor fr mr20 mt10 import_list" />
    </div>
    <div id="statisticsTABLE">
        <table class="fontc_666 height32" align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" width="100%">
            <thead class=" fontc_999" bgColor="#4e98bd" style="color:#fff;">
                <tr height="38">
                    <th width="150" align="center" colspan="2" valign="middle" class="border_d">
                        <span style="padding:0 5px;"><?php echo $exam_array['exam_term_name']; ?></span>
                    </th>
                    <th width="200" align="center" colspan="4" valign="middle" class="border_d">
                        <span style="padding:0 5px;">总分</span>
                    </th>
                    <?php echo $table1; ?>
                    <!--<th width="200" align="center" colspan="4" valign="middle" class="border_d">
                        <span style="padding:0 5px;">全科合格率</span>
                    </th>-->
                </tr>
                <tr height="38">
                    <th align="center" class="border_d" valign="middle" width="100">
                        <span style="padding:0 5px;">学校</span>
                    </th>
                    <th align="center" class="border_d" valign="middle" width="50">
                        <span style="padding:0 5px;">考试人数</span>
                    </th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">平均分</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">优秀率</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">及格率</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">低分率</span></th>
                    <?php echo $table2; ?>
                    <!--<th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">平均分</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">优秀率</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">及格率</span></th>
                    <th align="center" class="border_d" valign="middle" width="50"><span style="padding:0 5px;">低分率</span></th>-->
                </tr>
            </thead>
            <tbody style="background:#fff;">
                <?php echo $table3; ?>                                                                                                                                   
            </tbody>
        </table>
    </div>
</div>
<script>
    $(function(){
        var data_pj_array = <?php echo json_encode(isset($photo_image_data['pj_photo'])?$photo_image_data['pj_photo']:''); ?>;
        var data_yx_array = <?php echo json_encode(isset($photo_image_data['yx_photo'])?$photo_image_data['yx_photo']:''); ?>;
        var data_jg_array = <?php echo json_encode(isset($photo_image_data['jg_photo'])?$photo_image_data['jg_photo']:''); ?>;
        var data_df_array = <?php echo json_encode(isset($photo_image_data['df_photo'])?$photo_image_data['df_photo']:''); ?>;
        var photo_dataNum_data = <?php echo json_encode(isset($photo_dataNum_data)?$photo_dataNum_data:''); ?>;
        var data = data_pj_array;
            data.dataNum = <?php echo json_encode(isset($photo_dataNum_data['pj_photo'][0])?$photo_dataNum_data['pj_photo'][0]:''); ?>;
        YUEchart.averageChart( $("#statisticsChart"),data );
        
        $(".statisticsNav ul li" ).click(function(){
            $(this).addClass("on").siblings().removeClass( "on" );
            var school_i= $(this).index(),
                typeId = $( ".statisticsType_nav li.on" ).index();
            var data = {};
            if( typeId == 0 ){
                data = data_pj_array;
                data.dataNum=photo_dataNum_data.pj_photo[school_i];
            }else if( typeId == 1 ){
                data = data_yx_array;
                data.dataNum=photo_dataNum_data.yx_photo[school_i];
            }else if( typeId == 2 ){
                data = data_jg_array;
                data.dataNum=photo_dataNum_data.jg_photo[school_i];
            }else{
                data = data_df_array;
                data.dataNum=photo_dataNum_data.df_photo[school_i];
            }
            YUEchart.averageChart( $("#statisticsChart"),data );     
        });
        $( ".statisticsType_nav li" ).click(function(){
            $(this).addClass("on").siblings().removeClass( "on" );
            var typeId= $(this).index(),
                school_i = $(".statisticsNav .on").index();
            var data = {},
                photoType = '';

            if( typeId == 0 ){
                data = data_pj_array;
                data.dataNum=photo_dataNum_data.pj_photo[school_i];
            }else if( typeId == 1 ){
                data = data_yx_array;
                data.dataNum=photo_dataNum_data.yx_photo[school_i];
            }else if( typeId == 2 ){
                data = data_jg_array;
                data.dataNum=photo_dataNum_data.jg_photo[school_i];
            }else{
                data = data_df_array;
                data.dataNum=photo_dataNum_data.df_photo[school_i];
            } 
            YUEchart.averageChart( $("#statisticsChart"),data );
        });
        
        var exam_id = '<?php echo $exam_id; ?>';
        var school_id = '<?php echo $school_id; ?>';
        
        //导出相关数据
        $(".import_list").click(function(){
           $.get('/st/default/import_list', {exam_id: exam_id,school_id: school_id}, function(data) {
                if(data==1){
                    $.dialog.alert('导出数据不存在');
                }else{
                    window.location.href = '<?php echo $this->createUrl('/st/default/import_list'); ?>/exam_id/<?php echo $exam_id; ?>/school_id/<?php echo $school_id; ?>';
                }
                return false;
            });
        });
    });
</script>